drop onsetofriskRSA
gen onsetofriskRSA=.
replace onsetofriskRSA=1957 if independence<=1957
replace onsetofriskRSA=independence if independence>1957
tab onsetofriskRSA, m
set memory 2m 

drop exposuretoRSA
snapspan cowcode year1 RSA, gen(exposuretoRSA)
sort cowcode year
rename year year1
tab exposuretoRSA
stset year1, id(cowcode) time0(exposuretoRSA) origin(time onsetofriskRSA) failure(RSA==1)

gen poplog=log(population)
replace poplog=log(population)
gen violence=log(actotal)
replace violence=0.000001 if actotal==0
gen gdplog=log(gdp)
replace gdplog=log(gdp)
gen violencelog=log(civtot)
replace violencelog=0.000001 if civtot==0

streg i.NGO i.agreementwhelveh i.Worldreport poplog gdplog urbanization i.commonwealth violence i.roadconvention  i.vehcat, dist(weibull)
streg i.NGO i.agreementwhelveh i.Worldreport, dist(weibull)
streg i.NGO i.agreementwhelveh i.Worldreport poplog, dist(weibull)
streg i.NGO i.agreementwhelveh i.Worldreport poplog gdplog urbanization i.commonwealth violence  i.roadconvention , dist(w)  vce (cluster NetworkUNregion)
streg i.NGO i.agreementwhelveh i.Worldreport poplog gdplog urbanization i.commonwealth violence  i.roadconvention , dist(w)  
streg i.NGO i.agreementwhelveh i.Worldreport poplog gdplog urbanization civtot commonwealth i.roadconvention , dist(w)  vce (cluster NetworkUNregion)
streg i.NGO i.agreementwhelveh i.Worldreport poplog gdplog urbanization  i.roadconvention , dist(w)  vce (cluster NetworkUNregion)

streg  i.NGO i.agreementwhelveh i.Worldreport poplog gdplog urbanization  i.roadconvention  , dist(w)  vce (cluster NetworkUNregion)


stcox    i.agreementwhelveh i.roadconvention i.commonwealth poplog  i.Worldreport i.NGO gdplog urbanization if year1<2014  ,   vce (cluster NetworkUNregion)
stcox    i.agreementwhelveh i.roadconvention i.commonwealth poplog  i.Worldreport i.NGO gdplog urbanization civtot if year1<2014  ,   vce (cluster NetworkUNregion)

streg  i.agreementwhelveh i.roadconvention i.commonwealth poplog i.Worldreport i.NGO gdplog urbanization  , dist(w)  vce (cluster NetworkUNregion)
tab vehposit



*models for the paper
*Model 1
foreach model in exponential weibull gompertz   {
	streg  i.roadconvention i.agreementwhelveh  i.commonwealth poplog  i.Worldreport i.NGO ib3.newveh1 gdplog urbanization , dist (`model')  vce (cluster NetworkUNregion)
	estimates store `model' 
}
estimates stats _all



*Model 2*
foreach model in exponential weibull gompertz   {
	streg i.roadconvention  i.agreementwhelveh i.commonwealth poplog  civtot i.Worldreport i.NGO ib3.newveh1 gdplog urbanization , dist (`model')  vce (cluster NetworkUNregion)
	estimates store `model' 
}
estimates stats _all


*Model 7a Africa*
foreach model in exponential weibull gompertz   {
	streg i.roadconvention  i.commonwealth poplog  civtot i.Worldreport i.NGO ib3.newveh1 gdplog urbanization if NetworkUNregion<6 , dist (`model')  vce (cluster NetworkUNregion)
	estimates store `model' 
}
estimates stats _all

*Model 8a ASIA and the PACIFIC*
foreach model in exponential weibull gompertz   {
	streg i.roadconvention i.agreementwhelveh i.commonwealth poplog civtot i.Worldreport i.NGO ib3.newveh1 gdplog urbanization if asiapacific==1, dist (`model')  vce (cluster NetworkUNregion)
	estimates store `model' 
}
estimates stats _all

*Model 9a Western ASIA *
foreach model in exponential weibull gompertz   {
	streg i.roadconvention i.agreementwhelveh i.commonwealth poplog  civtot i.Worldreport i.NGO ib3.newveh1 gdplog urbanization if westasia==1, dist (`model')  vce (cluster NetworkUNregion)
	estimates store `model' 
}
estimates stats _all



*Model 10a Europe and NA*
foreach model in exponential weibull gompertz   {
	streg i.roadconvention i.agreementwhelveh i.commonwealth Eurocouncil poplog  civtot i.Worldreport i.NGO ib3.newveh1 gdplog urbanization if   NetworkUNregion==11 | NetworkUNregion==12 | NetworkUNregion==13  | NetworkUNregion==14 | NetworkUNregion==18, dist (`model')  vce (cluster NetworkUNregion)
	estimates store `model' 
}
estimates stats _all

*Model 11a LAC*
foreach model in exponential weibull gompertz   {
	streg i.roadconvention i.agreementwhelveh i.commonwealth poplog  civtot i.Worldreport i.NGO ib3.newveh1 gdplog urbanization if   NetworkUNregion==15 | NetworkUNregion==16| NetworkUNregion==17, dist (`model')  vce (cluster NetworkUNregion)
	estimates store `model' 
}
estimates stats _all


*Model 12a Commonwealth*
foreach model in exponential weibull gompertz   {
	streg i.roadconvention  poplog  civtot i.Worldreport i.NGO ib3.newveh1 gdplog urbanization if  commonwealth==1, dist (`model')  vce (cluster NetworkUNregion)
	estimates store `model' 
}
estimates stats _all




